package centerberg.engine;

import java.awt.Component;

/**
 * The interface of a render.
 * 
 * @author Andreas Svanberg
 */
public abstract class Render
{
    protected Camera activeCamera;
    
    protected Render()
    {
    }
    
    /**
     * Creates a new scene that can be rendered by the
     * implementing render.
     */
    public abstract Scene createScene();
    
    /**
     * Renders the scene.
     * 
     * @param scene the scene to render
     */
    public abstract void render(Scene scene);
    
    /**
     * Sets the active camera determining the viewport.
     * 
     * @param camera the camera
     */
    public void setActiveCamera(Camera camera)
    {
        activeCamera = camera;
    }
    
    /**
     * Returns the active camera.
     * 
     * @return active camera
     */
    public Camera getActiveCamera()
    {
        return activeCamera;
    }
    
    /**
     * Tries to initialize the render.
     * 
     * @return {@code true} if initialization was successfull
     */
    public abstract boolean init();
    
    /**
     * Returns the component on which the rendering happens.
     * For internal use such as MediaTracker tracking when images have been
     * loaded.
     * 
     * @return the component on which the rendering happens
     */
    abstract Component getRenderingComponent();
}